<div id="tb<{$uniqid}>" style="padding: 0 8px 0 0;">
    <form id="newsaddfm" method="post" enctype="multipart/form-data">
        <table border="0" width="100%" cellspacing="1" cellpadding="5" class="formtable">
            <tr bgcolor="#FFFFFF">
                <td class="tlabel" width="10%">标题:</td>
                <td colspan="5" width="90%"><input name="title" type="text" style="width:400px;" class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox" placeholder="请输入标题." required="true"></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td class="tlabel">栏目:</td>
                <td class="main">
                    <SELECT name='cat_id' size='1' required="true" class="forminput inputstyle">
                        <?php foreach($news_cat as $k=>$v):?>
                        <OPTION value="<?php echo $v->id;?>"><?php echo $v->title;?></OPTION>
                        <?php foreach($v->children as $k1=>$v1):?>
                        <OPTION value="<?php echo $v1->id;?>">&nbsp;&nbsp;|--<?php echo $v1->title;?></OPTION>
                        <?php endforeach;?>
                        <?php endforeach;?>
                    </SELECT>
                </td>
                <td class="tlabel">关键词:</td>
                <td colspan="3"><input name="keywords" type="text" style="width:400px;" class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox" placeholder="请输入关键词"></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td class="tlabel">作者:</td>
                <td class="main"><input type="text" size="20" name="author" class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox" placeholder="请输入作者" value=""></td>

                <td class="tlabel">来源:</td>
                <td><input type="text" size="20" name="copyfrom" class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox" placeholder="请输入来源" value=""></td>

                <td class="tlabel">来源网址:</td>
                <td><input type="text" size="45" class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox" placeholder="请输入来源网址" name="copyfromurl" value=""></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td class="tlabel">排序:</td>
                <td class="main"><input type="text" name="sortorder" size="20" class="forminput inputstyle validatebox-text textbox-prompt easyui-validatebox" value="500"/></td>
                <td class="tlabel">状态:</td>
                <td><label><input name="status" type="checkbox" class="textbox-prompt" value="1" checked="checked">激活</label></td>
                <td class="tlabel">推荐:</td>
                <td class="main"><label><input type="checkbox" name="recommend" class="textbox-prompt" value="1"/>设为推荐</label></td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td class="tlabel">缩略图:</td>
                <td class="main" colspan="5">
                    <span id="newsaddlogo"></span>
                    <a href="javascript:;" class="a-upload l-btn"><input type="file" id="newsaddupfile" name="upfile" accept="image/gif,image/jpeg,image/jpg,image/png,image/svg" onchange="html5ReaderNewsadd()"><i class="iconfont icon-xiangji"></i> 点击这里上传缩略图</a>
                </td>
            </tr>
            <tr bgcolor="#FFFFFF">
                <td class="tlabel">内容:</td>
                <td colspan="5">
                    <script id="newsaddEditor" name="content" type="text/plain"></script>
                </td>
            </tr>
            <tr>
                <td colspan="6" bgcolor="#F4F4F4" style="border-top:#ddd 1px solid;text-align:right;text-indent: 0;">
                    <div class="dialog-button">
                        <a href="javascript:;" class="l-btn l-btn-small" onclick="newsaddsubmitForm()"><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">保存</span><span class="l-btn-icon icon-ok">&nbsp;</span></span></a>
                        <a href="javascript:;" class="l-btn l-btn-small" onclick="newsaddclearForm()"><span class="l-btn-left l-btn-icon-left"><span class="l-btn-text">关闭</span><span class="l-btn-icon icon-no">&nbsp;</span></span></a>
                    </div>
                </td>
            </tr>
        </table>
    </form>
</div>

<script>
    /***关闭umeditor BOF***/
    if (typeof (newsaddum) != 'undefined') {
        newsaddum.destroy();
    }
    /***关闭umeditor EOF***/
    var newsaddum = UM.getEditor('newsaddEditor');
    var newsaddclearForm = function () {
        $('#newsaddfm').form('clear');
        $('#rightTabs').tabs('close', '添加文章');
    };
    var newsaddsubmitForm = function () {
        $('#newsaddfm').form('submit', {
            url: '/admin/news/newsinsert',
            success: function (data) {
                var data = eval('(' + data + ')');

                if (data.code == '200') {
                    $.messager.show({
                        title: '提示',
                        msg: data.msg,
                        timeout: 3000,
                        showType: 'slide'
                    });
                    $('#newsaddfm').form('clear');
                    if (typeof ($("#news")) != 'undefined') $("#news").datagrid('reload');
                    $('#rightTabs').tabs('close', '添加文章');
                } else {
                    $.messager.alert('提示', data.msg, 'warning');
                }
            }
        });
    };
</script>
